package office.dao.business;

import java.util.Iterator;
import java.util.Map;

import platform.common.dao.impl.BaseDomainProviderImpl;

public class ContractDP extends BaseDomainProviderImpl{
	
	//方法描述: 根据合同查询参数获取合同信息
	public String findContractByParam(Map condMap){
		StringBuffer strBuf = new StringBuffer();
		strBuf.append(" from "+ this.getDomainClassName() + " where 1=1 ");
		Iterator it = condMap.keySet().iterator();
		while(it.hasNext()){
			String str = (String)it.next();
			if(str.equals("contractName")){
				strBuf.append(" and contractName like '%"+condMap.get(str)+"%' ");
			}
			if(str.equals("contractCode")){
				strBuf.append(" and contractCode like '%"+condMap.get(str)+"%' ");
			}
			if(str.equals("contractType")){
				strBuf.append(" and contractType = '"+condMap.get(str)+"' ");
			}
			if(str.equals("createMan")){
				strBuf.append(" and ( createMan = '"+condMap.get(str)+"' or salesMan = '"+condMap.get(str)+"')");
			}
			if(str.equals("projectUnit")){
				strBuf.append(" and projectUnit like '%"+condMap.get(str)+"%' ");
			}
			if(str.equals("salesMan")){
				strBuf.append(" and salesMan = '"+condMap.get(str)+"' ");
			}
			if(str.equals("signDate")){
				strBuf.append(" and signDate >= to_date('"+condMap.get(str)+"','yyyy-mm-dd' )");
			}
			if(str.equals("endSignDate")){
				strBuf.append(" and signDate <= to_date('"+condMap.get(str)+"','yyyy-mm-dd' )");
			}
		}
		strBuf.append(" order by signDate");
		return strBuf.toString();
	}
	//方法描述: 根据合同状态获取合同
	public String findContractByStatus(Map condMap){
		StringBuffer strBuf = new StringBuffer();
		strBuf.append(" from "+ this.getDomainClassName() + " where 1=1 ");
		Iterator it = condMap.keySet().iterator();
		while(it.hasNext()){
			String str = (String)it.next();
			/*if(str.equals("status")){
				strBuf.append(" and status > '"+condMap.get(str)+"' ");
			}*/
		}
		return strBuf.toString();
	}
}
